<?php
namespace app\home\controller;

class Index extends Base
{
    public function _initialize() {
        parent::_initialize();
    }

    public function index()
    {
        if (config('is_https')) {
            $filename = 'indexs.html';
        } else {
            $filename = 'index.html';
        }

        if (file_exists($filename)) {
            @unlink($filename);
        }

        //自动生成HTML版
        if(isset($_GET['clear']) || !file_exists($filename))
        {
            /*获取当前页面URL*/
            $result['pageurl'] = request()->url(true);
            /*--end*/
            $eyou = array(
                'field' => $result,
            );
            $this->eyou = array_merge($this->eyou, $eyou);
            $this->assign('eyou', $this->eyou);
            
            /*模板文件*/
            $viewfile = 'index';
            /*--end*/

            /*多语言内置模板文件名*/
            $lang = get_home_lang();
            if (!empty($lang)) {
                $viewfilepath = TEMPLATE_PATH.$this->theme_style.DS.$viewfile."_{$lang}.".$this->view_suffix;
                if (file_exists($viewfilepath)) {
                    $viewfile .= "_{$lang}";
                }
            }
            /*--end*/

            //$viewfile=$viewfile.'-del';
            //http://mei94.com/cms/index.php?m=home&c=Lists&a=index&tid=2
            
            
            $this->assign('path', './cms');
            
            $html = $this->fetch(":{$viewfile}");
        
         
            return $html;
        }
    }
}